<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>登录</title>
  <link rel="stylesheet" type="text/css" href="./plugins/layui/css/layui.css" media="all"/>
  <link rel="stylesheet" href="./css/login2.css">
  <script type="text/javascript" src="./plugins/jquery/jquery.min.js"></script>
  <script type="text/javascript" src="https://raw.githubusercontent.com/julianshapiro/velocity/master/velocity.min.js"></script>
  <script type="text/javascript" src="./plugins/layui/layui.js"></script>
  <script type="text/javascript" src="./scripts/login2.js"></script>
  <style>
    body {
        height: 100vh;
        display: grid;
        place-content: center;
        background: linear-gradient(90deg, #060a3f 0%,#2b60d7 100%);
        overflow: hidden;
    }
  </style>
  
      <script type="text/javascript">
        $(function () {
   
            $(".login-button").click(function () { //“登录”按钮单击事件
                //获取用户名称
                var userid = encodeURI($("#userid").val());
                //获取输入密码
                var password = encodeURI($("#password").val());
                //开始发送数据
                $.ajax
                ({ //请求登录处理页
                    url: "http://localhost:8080/dictation/teacher?method=WebTeacherLogin", //登录处理页
                    dataType: "html",
                    //传送请求数据
                    data: { userid: userid, password: password },
                    success: function (strValue) { //登录成功后返回的数据
                        //根据返回值进行状态显示
                        if (strValue == "True") {//注意是True,不是true
                        	 $(window).attr('location','http://localhost:8080/tpend/index.html')
                        }
                        else {
                        	layer.alert('用户名或密码错误');
                        }
                    }
                })
            })
        })
    </script>
</head>
<body class="login-wrap">
  <canvas style="position:fixed;z-index:-1;"></canvas>
    <div class="login-container">
        <form class="login-form" >
            <div class="input-group">
                <input type="text" id="userid" class="input-field">
                <label for="userid" class="input-label">
                    <span class="label-title">用户编号</span>
                </label>
            </div>
            <div class="input-group">
                <input type="password" id="password" class="input-field">
                <label for="password" class="input-label">
                    <span class="label-title">密码</span>
                </label>
            </div>
            <button type="button" class="login-button">登录<i class="ai ai-enter"></i></button>
        </form>
    </div>
</body>
</html>
